﻿using System;
using System.Collections.Generic;
using System.Configuration;
using System.Data;
using System.Linq;
using System.Threading.Tasks;
using System.Web.UI.WebControls;
using System.Windows;
using DataFileApplication_WPF.Models;
using DataFileApplication_WPF.ViewModels;
using DataFileApplication_WPF.Views;
using Prism.DryIoc;


namespace DataFileApplication_WPF
{
    /// <summary>
    /// App.xaml 的交互逻辑
    /// </summary>
    public partial class App : Application
    {
        protected override void OnStartup(StartupEventArgs e)
        {
            base.OnStartup(e);
            string filePath = null;
            if (e.Args.Length > 0)
            {
                filePath = e.Args[0];
            }
            var mainWindow = new MainView();
            if (!string.IsNullOrEmpty(filePath))
            {
                if (mainWindow.DataContext is MainViewModel mainViewModel)
                {
                    mainViewModel.FilePath = filePath;
                    mainViewModel.LoadFileCommand.Execute(filePath);
                }
             
            }
           mainWindow.Show();
        }
    }
}
